/*******************************************************************************
 * File Name: GPS_Configuration.h
 *
 * Version: 1.0
 *
 * Description:
 * 	
 * Author: ppks
 *
 * Notes:
 * 	
 *
 ********************************************************************************
 * Copyright (<year>)
 ********************************************************************************
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 ********************************************************************************/

#ifndef GPS_CONFIGURATION_H_
#define GPS_CONFIGURATION_H_

/********************************************************************************/
/* Constants Definition                                                         */
/********************************************************************************/

/********************************************************************************/
/* Types Definition                                                             */
/********************************************************************************/
/* Global GPS Configuration Structure */
typedef struct {
    /* Don't forget to change the reply size in GUI when change this struct; */

    /* ON/OFF flags */
    /* First byte */
    uint8_t filtering : 1;
    uint8_t  lead_filter : 1;
    uint8_t  dont_reset_home_at_arm : 1;
    uint8_t  nav_controls_heading : 1;
    uint8_t  nav_tail_first : 1;
    uint8_t  nav_rth_takeoff_heading : 1;
    uint8_t  slow_nav : 1;
    uint8_t  wait_for_rth_alt : 1;
    /* Second byte */
    uint8_t  ignore_throttle: 1;                     /* Disable stick controls during mission and RTH */
    uint8_t  takeover_baro: 1;

    /* Configuration Paramters */
    uint16_t wp_radius;                             /* in cm */
    uint16_t safe_wp_distance;                      /* in meters */
    uint16_t nav_max_altitude;                      /* in meters */
    uint16_t nav_speed_max;                         /* in cm/s */
    uint16_t nav_speed_min;                         /* in cm/s */
    uint8_t  crosstrack_gain;                       /* x100 (0-2.56) */
    uint16_t nav_bank_max;                          /* degree * 100; (3000 default) */
    uint16_t rth_altitude;                          /* in meters */
    uint8_t  land_speed;                            /* between 50 and 255 (100 approx = 50cm/sec) */
    uint16_t fence;                                 /* fence control in meters */
    uint8_t  max_wp_number;
    uint16_t checksum;                              /* CRC 16 checksum. Note: must be at the end of the strucutre */
} GPSConfig_t;

/********************************************************************************/
/* Exported Variables Declaration                                               */
/********************************************************************************/
extern GPSConfig_t      GPS_Config;

/********************************************************************************/
/* Exported Functions Prototypes                                                */
/********************************************************************************/
extern void GPS_LoadDefaultConfiguration(void);
extern void GPS_LoadConfiguration(void);


#endif /* GPS_CONFIGURATION_H_ */
